package com.zenghus.v1;

import com.zenghus.v1.Configuration;
import com.zenghus.v1.Executor;

import java.util.List;

public class SqlSession {

    public Configuration configuration;
    public Executor executor;

    public SqlSession(Configuration configuration, Executor executor) {
        this.configuration = configuration;
        this.executor = executor;
    }

    /**
     * getmapper
     * @param clazz
     */
    public <T> T getMapper(Class clazz){
        return (T) configuration.getMapper(clazz,this);
    }


    public List selectOne(String sql, Object[] param){
        return executor.query(sql,param);
    }
}
